package com.loyal.mwm.ui;

import android.view.View;

import androidx.appcompat.widget.Toolbar;

import com.loyal.client.impl.RxSubscriberListener;
import com.loyal.mwm.R;
import com.loyal.mwm.base.BaseSwipeActivity;
import com.loyal.mwm.databinding.ActivityForgetBinding;
import com.loyal.mwm.libs.rxjava.RxProgressSubscriber;
import com.loyal.mwm.util.ImageUtil;
import com.loyal.rx3.RxUtil;

public class ForgetActivity extends BaseSwipeActivity<ActivityForgetBinding> implements View.OnClickListener, RxSubscriberListener<String> {
    @Override
    public int actLayoutRes() {
        return R.layout.activity_forget;
    }

    @Override
    public void afterOnCreate() {
        initViews();
    }

    private void initViews() {
        Toolbar toolbar = binding.toolbar.getRoot();
        toolbar.setTitle("重置密码");
        setSupportActionBar(toolbar);
        binding.forgetTest.setOnClickListener(this);
    }

    @Override
    public int setEdgePosition() {
        return LEFT;
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.forget_test) {
            RxProgressSubscriber<String> subscriber = new RxProgressSubscriber<>(this, "192.168.0.110");
            subscriber.setSubscribeListener(this);
            RxUtil.rxExecute(subscriber.loginByParams("loyal", "111111"), subscriber);
        }
    }

    @Override
    public void onResult(int what, Object tag, String s) {
    }

    @Override
    public void onError(int what, Object tag, Throwable e) {
        showErrorToast("", e);
    }
}
